package com.faner.fast.exception;

import com.faner.fast.constant.enums.CodeEnum;
import org.springframework.http.HttpStatus;

/**
 * 失败异常
 * description: FailedException
 * date: 2020/11/20 16:12
 * author: faner
 */
public class FailedException extends HttpException {
    protected int code = CodeEnum.FAIL.getCode();

    protected int httpCode = HttpStatus.INTERNAL_SERVER_ERROR.value();

    public FailedException() {
        super(CodeEnum.FAIL.getCode(), CodeEnum.FAIL.getMessage());
    }

    public FailedException(String message) {
        super(message);
    }

    public FailedException(int code) {
        super(code, CodeEnum.FAIL.getMessage());
        this.code = code;
    }

    public FailedException(int code, String message) {
        super(code, message);
        this.code = code;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public int getHttpCode() {
        return httpCode;
    }
}
